package com.larry.mr2.partition2;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class FlowDriver {
    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        job.setJarByClass(FlowDriver.class);

        job.setMapperClass(FlowMapper.class);
        job.setReducerClass(FlowReducer.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(FlowBean.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(FlowBean.class);

        job.setNumReduceTasks(5);
        job.setPartitionerClass(CustomPartition.class);

        FileInputFormat.setInputPaths(job,new Path("C:\\Users\\lishanglai\\IdeaProjects\\map-reduce\\src\\main\\resources\\input\\phone_data.txt"));
        FileOutputFormat.setOutputPath(job,new Path("C:\\Users\\lishanglai\\IdeaProjects\\map-reduce\\src\\main\\resources\\output5"));

        job.waitForCompletion(true);
    }
}
